package a.f.h.f.a;

import a.c.d;
import a.c.k;
import a.c.m;
import a.c.*;
import a.f.j.cb;
import a.f.j.db;
import a.i.p;

public class e
  implements db
{
  public static final int a = 0;
  public static final int b = 1;
  public static final int c = 2;
  protected x d;
  protected a.c.n e;
  protected cb f = null;
  protected q g = null;
  public static boolean h;
  public static int i;
  
  public e(q paramq)
  {
    this.g = paramq;
    this.d = paramq.B();
    this.e = paramq.C();
  }
  
  public e(cb paramcb)
  {
    this(paramcb.a());
    a(paramcb);
  }
  
  public void a(cb paramcb)
  {
    this.f = paramcb;
    paramcb.a(this);
  }
  
  public void a()
  {
    this.g.a(this.d);
    this.g.a(this.e);
  }
  
  public void a(a.c.e parame, d paramd)
  {
    c(parame).a(paramd);
  }
  
  public void c(a.c.e parame, d paramd)
  {
    c(parame).c(paramd);
  }
  
  public d a(a.c.e parame)
  {
    return c(parame).a();
  }
  
  public d b(a.c.e parame)
  {
    return c(parame).c();
  }
  
  public int a(d paramd)
  {
    return this.e.getInt(paramd);
  }
  
  public void a(d paramd, int paramInt)
  {
    this.e.a(paramd, paramInt);
  }
  
  public void a(d paramd, d[] paramArrayOfd)
  {
    int n = i;
    boolean bool = h;
    a.c.e locale1 = paramd.e();
    a.c.e locale2 = paramd.f();
    int j = this.e.getInt(paramd);
    int k = a(j);
    int m = 0;
    if (m < paramArrayOfd.length) {
      this.e.a(paramArrayOfd[m], j);
    }
    while (n != 0)
    {
      if (n == 0)
      {
        if (bool) {
          break label111;
        }
        this.e.a(this.f.b(paramArrayOfd[m]), k);
        m++;
      }
      if (!bool) {
        break;
      }
    }
    label111:
    d locald1 = this.f.b(paramd);
    d locald2 = paramArrayOfd[0];
    d locald3 = this.f.b(paramArrayOfd[(paramArrayOfd.length - 1)]);
    if (n == 0)
    {
      if (paramd == a(locale1)) {
        a(locale1, locald2);
      }
      if (n != 0) {}
    }
    else if (paramd == b(locale1))
    {
      c(locale1, locald2);
    }
    if ((n != 0) || (locald1 != null))
    {
      if (n == 0) {
        if (locald1 == a(locale2)) {
          a(locale2, locald3);
        }
      }
      if (locald1 == b(locale2)) {
        c(locale2, locald3);
      }
    }
  }
  
  public void a(d[] paramArrayOfd, d paramd)
  {
    int j = i;
    d locald1 = this.f.b(paramd);
    d locald2 = paramArrayOfd[0];
    d locald3 = this.f.b(paramArrayOfd[1]);
    if (j == 0) {
      if (b(locald2.e()) == locald2) {
        c(locald2.e(), paramd);
      }
    }
    if (j == 0) {
      if (a(locald2.e()) == locald2) {
        a(locald2.e(), paramd);
      }
    }
    if (j == 0)
    {
      if (b(locald3.e()) == locald3) {
        c(locald3.e(), locald1);
      }
      if (j != 0) {}
    }
    else
    {
      if (a(locald3.e()) == locald3) {
        a(locald3.e(), locald1);
      }
      this.e.a(paramd, this.e.getInt(locald2));
    }
    this.e.a(locald1, a(this.e.getInt(paramd)));
  }
  
  public void a(d paramd, a.f.j.n[] paramArrayOfn1, a.f.j.n[] paramArrayOfn2)
  {
    int j = this.e.getInt(paramd);
    this.e.a(this.f.b(paramd), a(j));
  }
  
  public void b(d paramd, a.f.j.n[] paramArrayOfn1, a.f.j.n[] paramArrayOfn2) {}
  
  public k c()
  {
    new p()
    {
      public int getInt(Object paramAnonymousObject)
      {
        return e.this.a((d)paramAnonymousObject);
      }
    };
  }
  
  public boolean d()
  {
    int i2 = i;
    boolean bool = h;
    int j = 0;
    int k = 0;
    w localw = this.g.v();
    label175:
    label196:
    do
    {
      do
      {
        if (!localw.e()) {
          break;
        }
        int n = 0;
        int i1 = 0;
        a.c.e locale = localw.d();
        if (i2 != 0) {
          break label228;
        }
        if (bool) {
          break label227;
        }
        m localm = locale.n();
        do
        {
          do
          {
            if (!localm.e()) {
              break;
            }
            int m = a(localm.a());
            if (bool) {
              break label214;
            }
            if (m == 1)
            {
              n++;
              if (i2 != 0) {
                continue;
              }
              if (!bool) {}
            }
            else
            {
              if (i2 != 0) {
                continue;
              }
              if (m == 2) {
                i1++;
              }
            }
            localm.f();
          } while (!bool);
        } while (i2 != 0);
        if (i2 == 0) {
          if (n == 0)
          {
            if (i2 != 0) {
              break label175;
            }
            if (i1 > 0)
            {
              j++;
              if (i2 != 0) {
                continue;
              }
              if (!bool) {
                break label196;
              }
            }
          }
        }
        if (i2 == 0)
        {
          if (n > 0)
          {
            if (i2 != 0) {
              continue;
            }
            if (i1 == 0) {
              k++;
            }
          }
          localw.f();
        }
      } while (!bool);
    } while (i2 != 0);
    if (j == 1)
    {
      label214:
      if (i2 != 0) {
        break label230;
      }
      if (k == 1) {}
    }
    else
    {
      label227:
      label228:
      return false;
    }
    label230:
    return true;
  }
  
  public void a(a.c.e parame1, a.c.e parame2)
  {
    int m = i;
    boolean bool = h;
    q localq = this.f.a();
    w localw = localq.v();
    label151:
    label180:
    label187:
    label250:
    do
    {
      while (!bool)
      {
        if (!localw.e()) {
          break;
        }
        if (m == 0)
        {
          if (!parame1.equals(localw.d()))
          {
            if (m != 0) {
              continue;
            }
            if (!parame2.equals(localw.d()))
            {
              m localm = localw.d().n();
              if (localm.e()) {}
              while (m != 0)
              {
                if (bool) {
                  break label151;
                }
                if (this.e.getInt(localm.a()) == 0)
                {
                  localm.b();
                  if (!bool) {
                    break;
                  }
                }
              }
              int j = this.e.getInt(localm.a());
              if (m == 0) {
                if (j == 2)
                {
                  k = 1;
                  if (m != 0) {
                    break label187;
                  }
                  if (!bool) {
                    break label180;
                  }
                }
              }
              int k = 2;
              do
              {
                do
                {
                  if (!localm.e()) {
                    break;
                  }
                  if (bool) {
                    break label250;
                  }
                  if (this.e.getInt(localm.a()) == k) {
                    break;
                  }
                  localm.b();
                } while (!bool);
              } while (m != 0);
              if (this.e.getInt(localm.a()) == 2)
              {
                a(localw.d(), localm.a());
                if (m != 0) {
                  break label306;
                }
                if (!bool) {}
              }
              else
              {
                c(localw.d(), localm.a());
              }
              do
              {
                do
                {
                  if (!localm.e()) {
                    break;
                  }
                  if (bool) {
                    break label369;
                  }
                  if (this.e.getInt(localm.a()) == j) {
                    break;
                  }
                  localm.b();
                } while (!bool);
              } while (m != 0);
              if (this.e.getInt(localm.a()) == 2)
              {
                a(localw.d(), localm.a());
                if (m != 0) {
                  continue;
                }
                if (!bool) {}
              }
              else
              {
                c(localw.d(), localm.a());
              }
            }
          }
          localw.f();
        }
      }
    } while (m != 0);
    label306:
    label369:
    return;
  }
  
  public String e()
  {
    int j = i;
    boolean bool = h;
    StringBuffer localStringBuffer = new StringBuffer("\n");
    w localw = this.f.a().v();
    do
    {
      if (!localw.e()) {
        break;
      }
      a.c.e locale = localw.d();
      if (j == 0)
      {
        if (bool) {
          break label124;
        }
        localStringBuffer.append("Node: " + locale + " First Incoming: " + a(locale) + " First Outgoing: " + b(locale) + "\n");
        localw.f();
      }
    } while (!bool);
    label124:
    return localStringBuffer.toString();
  }
  
  private static int a(int paramInt)
  {
    if (i == 0) {
      switch (paramInt)
      {
      case 0: 
        return 0;
      case 1: 
        return 2;
      case 2: 
        return 1;
      }
    }
    return -1;
  }
  
  protected a_ c(a.c.e parame)
  {
    a_ locala_ = (a_)this.d.get(parame);
    if (i == 0) {
      if (locala_ == null)
      {
        locala_ = f();
        this.d.a(parame, locala_);
      }
    }
    return locala_;
  }
  
  protected a_ f()
  {
    return new a_();
  }
  
  public static class a_
  {
    private d a;
    private d c;
    public static boolean d;
    
    void a(d paramd)
    {
      this.a = paramd;
    }
    
    void c(d paramd)
    {
      this.c = paramd;
    }
    
    d a()
    {
      return this.a;
    }
    
    d c()
    {
      return this.c;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.h.f.a.e

 * JD-Core Version:    0.7.0.1

 */